<?php
include_once "../negocio/Empresa.php";
include("verificar_sesion.php");
//include "cabecera.php";
$Empresa = new Empresa();
//include "menu_administrativo.php";


if(isset($_REQUEST['button']))
{
    $Empresa->setRut($_REQUEST['rut_empresa']);
    $Empresa->setNombre($_REQUEST['nombre_empresa']);
    $Empresa->setCredito($_REQUEST['credito_empresa']);
    $Empresa->modificarEmpresa();
}
?>


    <?php
    $arregloObjetoFinal = $_SESSION['ArregloObjetos'];
     ?>



<?php

        $indice = $_GET['indice'];
        $obj = $arregloObjetoFinal[$indice];


    if(isset($_REQUEST['button']))
{
    $obj->setRut($_REQUEST['rut_empresa']);
    $obj->setNombre($_REQUEST['nombre_empresa']);
    $obj->setCredito($_REQUEST['credito_empresa']);

}


    ?>
<html>
    <haead>
        <link href="css/estilo_principal.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" language="JavaScript" src="js/jquery.js"></script>
        <script type="text/javascript" language="JavaScript" src="js/jquery.validate.js"></script>
        <script type="text/javascript" language="JavaScript" src="js/messages_es.js" charset="utf-8"></script>

        <link rel="stylesheet" href="css/jquery-ui-1.9.2.css" />
        <script src="js/jquery-ui-1.9.2.js"></script>


        <script>
        $(document).ready(function(){
        $("#cliente_modificar").validate();
        });
        </script>


        <script>
        $(function() {
        $( "#datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy-mm-dd'
            });
        });
        </script>

    </head>

   <body style="background-color:#F3F3F3">
    <h2>Modificar Empresa</h2>
<hr>
      <form method="post" id="cliente_modificar" action="" onsubmit="civil();">
      <table width="100%">
        <tr>
          <td width="16%">Rut Empresa</td>
          <td width="33%">
          <input type="text" name="rut_empresa" id="textfield" readonly value=<?php echo trim($obj->getRut()) ?> >          </td>
          <td width="24%">Nombre Empresa</td>
          <td width="27%">
          <input type="text" class="required" autocomplete="off" name="nombre_empresa" id="textfield1" value=<?php echo $obj->getNombre() ?> >          </td>
        </tr>
        <tr>
            <td>Crédito Empresa</td>
            <td><input type="text" class="required" autocomplete="off" name="credito_empresa" id="textfield1" value=<?php echo $obj->getCredito() ?> ></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>
            <input type="submit" name="button" id="button" value="Guardar Empresa" />
          </td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      </form>
<script>
function civil()
{
   var indice=document.getElementById("genero").selectedIndex;
   var genero=document.getElementById("genero").options[indice].value;
   var combo=document.getElementById("ecivil");
   if(genero==0)
   {
       combo.options[0].value='soltera';
       combo.options[1].value='casada';
       combo.options[2].value='viuda';
       combo.options[3].value='divorciada';

   }

   if(genero==1)
   {
       combo.options[0].value='soltero';
       combo.options[1].value='casado';
       combo.options[2].value='viudo';
       combo.options[3].value='divorciado';
   }
   alert(combo.options[0].value+'\n'+combo.options[1].value+'\n'+combo.options[2].value+'\n'+combo.options[3].value+'\n');
}
</script>
</body>
</html>
<? //include "pie.php" ?>
 <?
    $_SESSION['obj_ctrl_sistema'] = serialize($obj_ctrl_sistema);
?>